var CommonUtil = new CommonUtil();

function login() {
	var username = $('#j_username').val();
	console.log(username, '222');
	$.ajax({
		cache : true,
		type : 'POST',
		url : CommonUtil.getRootPath() + '/sm-demo/userLogin.action',
		data : JSON.stringify({
			username : username
		}),
		dataType : 'JSON',
		contentType : 'application/json',
		async : true,
//		beforeSend : checkForm,
		error : function(data) {

		},
		success : function(data) {
			toIndex();
		}
	});
}

function toIndex() {
	location.href = CommonUtil.getRootPath() + '/sm-demo/page/list/itemList.html';
}

$(function() {
	$('#js-btn-login').on('click', function() {
		login();
	});
});